#include "I_BaseLib.h"

COLOR COLOR::operator*(const COLOR& col)
{
	return COLOR(blue*col.blue,green*col.green,red*col.red); 
}

COLOR COLOR::operator*(float col)
{
	return COLOR((unsigned char)(blue*col),(unsigned char)(green*col),(unsigned char)(red*col)); 
}

COLOR COLOR::operator+(const COLOR& col)
{
	return COLOR(blue+col.blue,green+col.green,red+col.red); 
}

void COLOR::operator=(const COLOR& col)
{
	blue=col.blue;
	green=col.green;
	red=col.red; 
}

COLOR COLOR::operator*=(float col)
{
	return COLOR((unsigned char)(blue*col),(unsigned char)(green*col),(unsigned char)(red*col)); 
}

COLOR COLOR::operator+=(const COLOR& col)
{
	return COLOR(blue+col.blue,green+col.green,red+col.red); 
}

COLOR COLOR::Intensity(float i)
{
	return COLOR(blue+(unsigned char)(0xff*i),green+(unsigned char)(0xff*i),red+(unsigned char)(0xff*i));
}

COLOR COLOR::AlphaBlend(COLOR& background,float alpha)
{
	COLOR col = background*(1-alpha) + (*this)*alpha;
	return col;
}